/**
 * Copyright (C) 2012 The SkyTvOS Project
 * <p/>
 * Version     Date           Author
 * ─────────────────────────────────────
 * 2014年12月29日         luwei
 */

package com.coocaa.launcher.sidebar.setting.item.backexit;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.ToggleButton;

import com.coocaa.launcher.sidebar.left.SideItemView;
import com.coocaa.x.uipackage.SkinManager;
import com.tianci.appstore.R;
import com.tianci.appstore.utils.SkyConstants;

public class BackExitItem extends SideItemView {
    public BackExitItem(Context context) {
        super(context);
    }

    @Override
    public String getItemName() {
        // TODO Auto-generated method stub
        return SkinManager.getInstance().getString(R.string.setting_back_exit);
    }

    @Override
    public int getItemIconId() {
        // TODO Auto-generated method stub
        return R.drawable.launcher_set_icon_back;
    }

    @Override
    public View getRightView() {
        ToggleButton button = new ToggleButton(mContext);
        button.setTextOn("");
        button.setTextOff("");
        SkinManager.getInstance().setBackgroundResource(button, R.drawable.launcher_toggle_selector);
        button.setChecked(false);
        mRightView = button;
        LayoutParams params = new LayoutParams(
                Div(136), Div(80), Gravity.RIGHT | Gravity.CENTER_VERTICAL);
        params.rightMargin = SkyConstants.Div(30);
        mRightView.setLayoutParams(params);
        return mRightView;
    }

    public void setToggleButtonCheck(final boolean check) {
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ((ToggleButton) mRightView).setChecked(check);
            }
        });

    }

    @Override
    public void destory() {

    }

}
